Skip to main content

Elementry Counting Problems

Permutations (Definition)

The arrangement of different objects into a linear order using each object exactly once is called a permutation of these objects. The number n×(n1)×(n2)2×1n \times (n-1) \times (n-2) \cdots 2 \times 1 of all permutations of nn objects is called nn factorial, and is denotes by n!n!.

Theorem 1

The number of all permutations of an n-element set is n!n!.

Theorem 2

Let n,k,a1,a2,,akn, k, a_1, a_2, \cdots, a_k be nonnegative integers satisfying a1+a2++ak=na_1+a_2+\cdots+a_k=n. Consider a multiset of nn objects, in which aia_i objects are of type ii, for all i[k]i \in[k]. Then the number of ways to linearly order these objects is

n!a1!a2!ak!\frac{n !}{a_{1} ! \cdot a_{2} ! \cdots \cdots a_{k} !}

Strings over a Finite Alphabet

Theorem

The number of kk-digit strings over an nn-element alphabet is nkn^k.

Proof

We can choose the first digit in nn different ways. Then, we can choose the second digit in n different ways as well since we are allowed to use the same digit again (unlike in case of permutations). Similarly, we can choose the third, fourth, etc., kth element in n different ways. We can make all these choices independently from each other, so the total number of choices is nkn^k.

Defintion (Bijection)

Let XX and YY be two finite sets, and let f:XYf: X \rightarrow Y be a function so that

  1. if f(a)=f(b)f(a)=f(b), then a=ba=b, and
  2. for all yYy \in Y there is an xXx \in X so that f(x)=yf(x)=y,

then we say that ff is a bijection from XX onto YY. Equivalently, ff is a bijection if for all yYy \in Y, there exists a unique xXx \in X so that f(x)=yf(x)=y. In other words, a bijection matches the elements of XX with the elements of YY, so that each element will have exactly one match.

The functions that have only one of the two defining properties of bijections also have their own names.

Definition (Injection and Surjection)

Let f:XYf: X \rightarrow Y be a function. If ff satisfies criterion (1) of the bijection definition, then we say that ff is one-to-one or injective, or is an injection. If ff satisfies criterion (2), then we say that ff is onto or surjective, or is a surjection.

Proposition

Let XX and YY be two finite sets. If there exists a bijection ff from XX onto YY, then XX and YY have the same number of elements.

Proof

The bijection ff matches elements of XX to elements of YY, in other words it creates pairs with one element from XX and one from YY in each pair. If ff created mm pairs, then both XX and YY have mm elements.

Theorem

Let nn and kk be positive integers satisfying nkn \geq k. Then the number of kk-digit strings over an n-element alphabet in which no letter is used more than once is

n(n1)(nk+1)=n!(nk)!.n(n-1) \cdots(n-k+1)=\frac{n !}{(n-k) !} .

Proof

Indeed, we have nn choices for the first digit, n1n-1 choices for the second digit, and so on, just as we did in the case of factorials. The only difference is that here we do not necessarily use all our nn objects, we stop after choosing kk of them.

Choice Problems (Definition)

The number of kk-element subsets of [n][n] is denoted (nk)\left(\begin{array}{l}n \\ k\end{array}\right) and is read " nn choose kk ".

The numbers (nk)\left(\begin{array}{l}n \\ k\end{array}\right) are often called binomial coefficients.

Theorem

For all nonnegative integers knk \leq n, the equality

(nk)=n!k!(nk)!=(n)kk!\left(\begin{array}{l} n \\ k \end{array}\right)=\frac{n !}{k !(n-k) !}=\frac{(n)_k}{k !}

holds.

Proof

To select a kk-element subset of [n], we first select a kk-element string in which the digits are elements of [n][n]. By Theorem 3.6, we can do that in n!/(nk)!n ! /(n-k) ! different ways. However, in these strings the order of the elements does matter. In fact, each kk-element subset occurs kk ! times among these strings as its elements can be permuted in kk ! different ways. Therefore, the number of kk-element subsets is 1/k1 / k ! times the number of kk-element strings, and the proof follows.

Definition

Let S[n]S \subseteq[n]. Then the complement of SS, denoted ScS^c is the subset of [n][n] that consists precisely of the elements that are not in SS. In other words, ScS^c is the unique subset of [n][n] that for all i[n]i \in[n] satisfies the following statement: iSci \in S^c if and only if iSi \notin S.

The following proposition summarizes some straightforward properties of the numbers (nk)\left(\begin{array}{l}n \\ k\end{array}\right). We choose to announce these easy statements as a proposition since they will be used incessantly in the coming sections.

Proposition

For all nonnegative integers knk \leq n, the following hold.

  1. (nk)=(nnk).\left(\begin{array}{l} n \\ k \end{array}\right)=\left(\begin{array}{c} n \\ n-k \end{array}\right) .
  2. (n0)=(nn)=1.\left(\begin{array}{l} n \\ 0 \end{array}\right)=\left(\begin{array}{l} n \\ n \end{array}\right)=1 .

Proof

  1. We set up a bijection ff from the set of all kk-element subsets of [n][n] onto that of all nkn-k-element subsets of nn. This ff will be simplicity itself: it will map any given kk-element subset S[n]S \subseteq[n] into its complement ScS^c. Then for any nkn-k-element subset T[n]T \subseteq[n], there is exactly one SS so that f(S)=Tf(S)=T, namely S=TcS=T^c. So ff is indeed a bijection, proving that the number of kk-element subsets of [n][n] is the same as that of nkn-k-element subsets of [n][n], which, by definition, means that (nk)=(nnk)\left(\begin{array}{l}n \\ k\end{array}\right)=\left(\begin{array}{c}n \\ n-k\end{array}\right).
  2. The first equality is a special case of the claim of part 1 , with k=0k=0. To see that (n0)=1\left(\begin{array}{l}n \\ 0\end{array}\right)=1, note that the only 0 -element subset of [n][n] is the empty set.

Summary